﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;

namespace WasaWasa.Converters
{
    [ValueConversion(typeof(bool), typeof(Brush))]
    public class BoolBrushConverter : IValueConverter
    {
        public Brush TrueBrush { get; set; }
        public Brush FalseBrush { get; set; }

        public BoolBrushConverter()
        {
            TrueBrush = Brushes.Silver;
            FalseBrush = Brushes.White;
        }

        #region IValueConverter メンバ

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (bool)value ? TrueBrush : FalseBrush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (value as Brush) == TrueBrush;
        }

        #endregion
    }
}
